﻿@inherits AdminCompontentBase

<div class="d-flex" style="height: calc(100vh - 280px);">
    <LoginRegisterTemplate Tab=@CustomLoginTab.Register Logo="@Logo" Title="@Title" RegisterFields="Value.Where(v => v.RegisterFieldType!=default).ToList()" />
    <div style="border: 1px solid #E2E7F4;" class="mx-12 full-height" />
    <div class="my-5 overflow-y" style="width:100%">
        <MRow>
            <MCol Cols="6">
                <span class="body2 regular3--text">
                    @T("TitleName")
                </span>
            </MCol>
            <MCol Cols="2">
                <span class="body2 regular3--text">
                    @T("Required")
                </span>
            </MCol>
            <MCol>
                <span class="body2 regular3--text">
                    @T("Action")
                </span>
            </MCol>
        </MRow>
        <div class="mt-5">
            @foreach (var registerField in Value)
            {
                <MRow Class="mb-6" @key="@(registerField.RegisterFieldType!=default?registerField.RegisterFieldType:registerField.Sort)">
                    <MCol Cols="6">
                        <RegisterFieldSelect @bind-Value="registerField.RegisterFieldType" Excludes="Value.Select(v => v.RegisterFieldType).ToList()" />
                    </MCol>
                    <MCol Cols="2" Class="d-flex">
                        <MSwitch @bind-Value="registerField.Required" Class="my-auto my-0 pt-0" TValue="bool"/>
                    </MCol>
                    <MCol Class="d-flex">
                        <div class="my-auto">
                            <MButton Class="mr-6" Icon OnClick="async () =>await Up(registerField)" Disabled="registerField.Sort == Value.Min(v => v.Sort)">
                                <SIcon Tooltip="@T("Up")">mdi-menu-up</SIcon>
                            </MButton>
                            <MButton Class="mr-6" Icon OnClick="async () =>await Down(registerField)" Disabled="registerField.Sort == Value.Max(v => v.Sort)">
                                <SIcon Tooltip="@T("Down")">mdi-menu-down</SIcon>
                            </MButton>
                            <MButton Class="mr-6" Icon OnClick="async () =>await Remove(registerField)">
                                <SIcon Tooltip="@T("Delete")">mdi-delete-outline</SIcon>
                            </MButton>
                        </div>
                    </MCol>
                </MRow>
            }           
        </div>
    </div>
</div>
